<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>17_margin合并问题</title>

    <style>
      .box {
        width: 200px;
        height: 200px;
      }

      .box1 {
        background-color: deepskyblue;
        margin-bottom: 50px;
      }

      .box2 {
        background-color: deeppink;
        margin-top: 50px;
      }

      .test {
        width: 100px;
        height: 100px;
        display: inline-block;
      }
      .test1 {
        background-color: orange;
        margin-right: 10px;
      }

      .test2 {
        background-color: pink;
        margin-left: 10px;
      }
    </style>
  </head>
  <body>
    <!-- margin合并问题，只有marginTop和marginBottom会存在，取最大值，margin左右并不会有合并问题，规避这个问题即可，并没有良好的解决方案 -->
    <div class="box box1">1</div>
    <div class="box box2">2</div>
    <hr />

    <div class="test test1">1</div>
    <div class="test test2">2</div>
  </body>
</html>
